//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "math\fn_getRanOuterAirPoint.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_pos", "_centerx", "_centery", "_leftx", "_lefty", "_width", "_height", "_rside", "_px1", "_py1", "_radius", "_atan", "_x1", "_y1","_ret_val"];
_ret_val = [];
_pos = ["WORLD_CENTER",[0,0,0]] call FFUNC(getFrameworkValue);
_centerx = _pos select 0; _centery = _pos select 1;
_leftx = 250;_lefty = 250;
_width = (2 * (_pos select 0)) - 500;
_height = (2 * (_pos select 1)) - 500;
_rside = floor (random 4);
_px1 = switch (_rside) do {
	case 0: {_leftx + random _width};
	case 1: {_leftx + _width};
	case 2: {_leftx + random _width};
	case 3: {_leftx};
};
_py1 = switch (_rside) do {
	case 0: {_lefty + _height};
	case 1: {_lefty + random _height};
	case 2: {_lefty};
	case 3: {_lefty + random _height};
};
_radius = _pos distance [_px1,_py1,_pos select 2];
_atan = (_centerx - _px1) atan2 (_centery - _py1);
_x1 = _centerx - (_radius * sin _atan);
_y1 = _centery - (_radius * cos _atan);
_ret_val = [_x1, _y1, 300];

TRACE_1("End",_ret_val);
TMFPROFILERSTOP;
_ret_val